<!doctype html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/4.0.0/css/bootstrap.min.css"
          integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
    <link rel="stylesheet" th:href="@{/assets/css/category.css}">
    <title>
        搜索页面
    </title>

</head>

<body>

<!--导航栏-->
<!--引入 top bar-->
<div th:replace="commons/topbar::topbar">
</div>

<div class="container align-items-center">
<form class="form my-2 my-lg-0 pd-3" action="/search" method="get">
    <input class="form-control mr-lg-2" type="search" placeholder="输入关键词，如作者、书名" name="kw">
    <button class="btn btn-danger my-2 mr-lg-4 mt-2" type="submit">搜索</button>
</form>
    <div class="jumbotron" style="background-color: #e3f2fd">
        <div class="container mt-2">
            <div class="row">
                <div class="col-sm-12">
                    <div class="card">
                        <div class="card-body">
                            <h5 class="card-title">搜索结果</h5>
                            <ul class="list-group mr-auto">
                                <li class="list-group-item d-flex" th:each="novel,iterStat:${novels}">
                                    <div>
                                        <a href="#" target="_blank" class="book-img" th:href="|/info/${novel.id}|">
                                            <img src="https://bookcover.yuewen.com/qdbimg/349573/1012284323/150"
                                                 class="rounded float-left" th:attr="src=${novel.coverImage}">
                                        </a>
                                    </div>

                                    <div class="book-info container">
                                        <h5><a href="#" target="_blank" th:utext="${novel.name}" th:href="|/info/${novel.id}|">我有一座恐怖屋</a></h5>
                                        <p class="text-muted author" th:text="${novel.author}">
                                            我会修空调
                                        </p>
                                        <p class="intro" th:utext="${novel.description}">
                                            蒸汽与机械的浪潮中，谁能触及非凡？历史和黑暗的迷雾里，又是谁在耳语？我从诡秘中醒来，睁眼看见这个世界：枪械，大炮，巨舰，飞空艇，差分机；魔药，占卜，诅咒，倒吊人，封印物……光明依旧
                                        </p>
                                    </div>
                                </li>

                            </ul>


                            <nav aria-label="Page navigation" class="mt-4">
                                <ul class="pagination justify-content-center">
                                    <li class="page-item" th:each="page,iterStat:${pageBar}" th:class="${#strings.arraySplit(page, '=')[1].equals(nowPage)}?'page-item active':'page-item'">
                                        <a class="page-link" href="?page=1" aria-label="Previous" th:if="${iterStat.count}==1" th:href="|?page=1&kw=${kw}|">
                                            <span aria-hidden="true">首页 &laquo;</span>
                                            <span class="sr-only">Previous</span>
                                        </a>
                                        <a class="page-link" href="#"  th:if="${iterStat.last}" aria-label="Next" th:href="|${page}&kw=${kw}|">
                                            <span aria-hidden="true">&raquo; 末页</span>
                                            <span class="sr-only">Next</span>
                                        </a>
                                        <a class="page-link" href="#" th:if="!${iterStat.first} and !${iterStat.last} and !${#strings.equals(#strings.arraySplit(page,'=')[1], '...')}" th:text="${#strings.arraySplit(page, '=')[1]}"  th:href="|${page}&kw=${kw}|" >2</a>
                                        <span th:if="${#strings.equals(#strings.arraySplit(page,'=')[1], '...')}" class="page-link" style="pointer-events: none">...</span>
                                    </li>
                                </ul>
                            </nav>
                        </div>

                    </div>

                </div>
            </div>
        </div>
    </div>
</div>
<!--页脚-->
<!--<footer class="footer" th:replace="commons/footer::footer">-->
<!--</footer>-->

<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<div th:replace="commons/js::js">

</div>


<!--topbar js-->
<script type="text/javascript" th:replace="commons/topbar::js">
</script>
</body>

</html>